<template>
        <div>
        <img :src="pic" class="pic"> <br>
        <div class="title">
            <span>作者：{{goods.title}}</span>
            <span>观看量：{{goods.saleNum}}</span>
        </div>
        <div class="content">
            内容来源与天天美食......
        </div>
        <div class="detail">
            <span>详细教程:</span><br>
            <img v-for="val in goods.banner" :src="val.imageUrl">
        </div>
    </div>
</template>

<script setup>
import {ref} from 'vue'
import {getDetailData} from '../../api/detail'

const goods = ref({})
const pic = ref()
const getDetail= async()=>{
    const res = await getDetailData()
    const {data} = res
    console.log(data)
    goods.value = data[0]
    pic.value = goods.value.banner[3].imageUrl
}
getDetail()
</script>

<style scoped>
.pic{
    width: 375px;
    height: 340px
}
.title{
    width: 100%;
    height: 60px;
    line-height: 50px;
    padding: 0 16px;
    box-sizing: border-box;
    border-bottom: 10px solid #eee;
    display: flex;
    justify-content: space-between;
}   
.title span:nth-of-type(1){
    font-size: 16px;
}
.title span:nth-of-type(2){
    font-size: 12px;
    color: #999;
}
.content{
    height: 50px;
    line-height: 40px;
    text-align: center;
    border-bottom: 10px solid #eee;
}
.detail>span{
    display: block;
    height: 40px;
    line-height: 50px;
    margin-left: 10px;
    font-size: 14px;
}
</style>